import { createRouter, createWebHistory } from 'vue-router'
import My from '@/views/home/my.vue'
import Cart from '@/views/home/cart.vue'
import Cla from '@/views/home/cla.vue'
import Index from '@/views/home/index.vue'
import Home from '@/views/home/home.vue'
import lb from '@/views/lb/index.vue'
import xq from '@/views/xq/index.vue'
import login from '@/views/login/index.vue'
import Register from '@/views/Register/index.vue'
const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    { path: '/', redirect: '/home/index' },
    {
      path: '/home',
      name: 'home',
      component: Home, children: [
        {
          path: 'index',
          name: 'index',
          component: Index,
        },
        {
          path: 'cla',
          name: 'cla',
          component: Cla,
        },
        {
          path: 'cart',
          name: 'cart',
          component: Cart,
        },
        {
          path: 'my',
          name: 'my',
          component: My,
        },

      ]
    },
    {
      path: '/lb/:cat_name',
      name: 'lb',
      component: lb,
    },
    {
      path: '/xq/:goods_id',
      name: 'xq',
      component: xq,
    },

    {
      path: '/login',
      name: 'login',
      component: login,
    },
    {
      path: '/Register',
      name: 'Register',
      component: Register,
    },
  ],
})
export default router
